package com.itheima.controller;

import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.pojo.StudentOption;
import com.itheima.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/report")
public class ReportController {

    @Autowired
    private ReportService reportService;

    /***
     * 学员学历统计
     * studentDegreeData
     */
    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData(){
        //学员学历统计
        List<Map> list = reportService.getStudentDegreeData();
        return Result.success(list);
    }



    /***
     * 班级人数统计
     * studentCountData
     */
    @GetMapping("/studentCountData")
    public Result getStudentCountData(){
        //调用Service获取统计数据
        StudentOption studentOption = reportService.getStudentCountData();
        return Result.success(studentOption);
    }


    /***
     * 性别统计
     */
    @GetMapping("/empGenderData")
    public Result getEmpGenderData(){
        //List<Map>->调用Service
        List<Map> dataList = reportService.getEmpGenderData();
        return Result.success(dataList);
    }

    /***
     * 统计职位数量
     */
    @GetMapping("/empJobData")
    public Result getEmpJobData(){
        //调用Service查询  JobOption
        JobOption jobOption = reportService.getJobEmpData();
        return Result.success(jobOption);
    }

}
